package com.neutech.maplestory.client;

import com.neutech.maplestory.entity.Hero;
import com.neutech.maplestory.util.MapleStoryFrame;

import java.awt.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

/**游戏的主入口文件
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author ${秦}
 * @Date 2021/1/27 13:30
 */
public class MapleStoryClient extends MapleStoryFrame {
    public Hero hero = new Hero(300,500);

    @Override
    public void init() {
        super.init();
        this.addKeyListener(new KeyAdapter() {
            @Override
            public void keyPressed(KeyEvent e) {
                 hero.keyPressed(e);
            }

            @Override
            public void keyReleased(KeyEvent e) {
                     hero.keyReleased(e);

            }
        });
    }

    @Override
    public void paint(Graphics g) {
        hero.draw(g);
        Font f = g.getFont();
        g.setFont(new Font("微软雅黑",Font.BOLD,30));
        g.drawString("当前人物的方向为:" + hero.dir,100,100);
        g.drawString("当前人物的动作为:" + hero.action,100,150);
        g.drawString("当前人物:" + hero.down,100,200);
        g.setFont(f);
    }

    public static void main(String[] args) {
        new MapleStoryClient().init();
    }
}
